@extends('template.base')
@section('content')
 <script src="{{URL::to('js/jquery-1.10.2.js')}}"></script>
		<script>
		$(document).ready(function(){
		  $("#hide").click(function(){
		    $("#p").hide();
		  });
		  $("#show").click(function(){
		    $("#p").show();
		  });
		});

		</script>

		<div class="container-green" >
		<h2 class="text-center">ORDER ONLINE</h2>
				<div class="btn-group btn-group-justified" style="margin-bottom:20px">
						  <div class="btn-group">
						    <button type="button" class="btn btn-default active"><strong>Data Pesanan(Order)</strong></button>
						  </div>
						  <div class="btn-group">
						    <button type="button" class="btn btn-default" disabled><strong>Fitur Tambahan</strong></button>
						  </div>
						  <div class="btn-group">
						    <button type="button" class="btn btn-default" disabled><strong>Data Pemesan(Client)</strong></button>
						  </div>
				</div>
		<div class="row">
			<div class="col-lg-3">
			<label>Order :</label>
			<hr id="hr1" />
			<strong>Cetak ID Card</strong><br><br>
			<p align="center"><img id="img" src="{{URL::to('images/icon_kartu.jpg')}}" /><br><br>
			<a data-toggle="modal" data-target="#gantiorder"><button class="btn btn-primary" style="width:125px">Ganti order</button></a></p>    
			</div>
			<div class="col-lg-9">
			<label>Data pesanan(Detail order):</label>
			<hr id="hr1" />

					<div align="left">
							{{Form::open(array(
								'url' => 'order/orderidcard',
								'method' => 'POST',
								'files' => true
							))}}

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jenis ID Card (Type) <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="jenis_idcard" style="width:250px;height:30px" required>
				            	<option value="">Silahkan pilih</option>
				            	<?php 
				          			if(Input::Old('jenis_idcard')<>""){
					            	$id = Input::Old('jenis_idcard');
					            	}else{
					            	$id = Session::get('jenis_idcard');
					            	}
									foreach($jenis as $jns){
										if($jns->idcard_type_id == $id){
											echo '<option value="'.$jns->idcard_type_id.'" selected>'.$jns->idcard_type_name.'</option>';
										}else{
											echo '<option value="'.$jns->idcard_type_id.'">'.$jns->idcard_type_name.'</option>';
										}
									}
					            	?>
				            </select>
					        </td>
					        <td>
					        	  {{$errors->first('jenis_idcard')}}
					        </td>
					    	</table><br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Kualitas ID Card <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="kualitas_idcard" style="width:250px;height:30px" required>
				            	<option value="">Silahkan pilih</option>
				            	<?php 
				          			if(Input::Old('kualitas_idcard')<>""){
					            	$id = Input::Old('kualitas_idcard');
					            	}else{
					            	$id = Session::get('kualitas_idcard');
					            	}

									foreach($kualitas as $kualitas){
										if($kualitas->idcard_quality_id == $id){
											echo '<option value="'.$kualitas->idcard_quality_id.'" selected>'.$kualitas->idcard_quality_name.'</option>';
										}else{
											echo '<option value="'.$kualitas->idcard_quality_id.'">'.$kualitas->idcard_quality_name.'</option>';
										}
									}
					            	?>
				            </select>
				        	</td>
				        	<td>
				        		{{$errors->first('kualitas_idcard')}}
				        	</td>
				        </table>
				        	<br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Design (Referensi / Sendiri)</label><br>
				      		(Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
				      		</div>
      						<div class="col-lg-7">
				            <input type="file" class="form-control" id="i_file" name="design_idcard" style="width:250px;height:30px" />
				            <br>{{$errors->first('design_idcard')}}
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jumlah order <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<?php 
      								if(Input::Old('pilihan_jumlah')<>""){
					            	$pilihan_jumlah = Input::Old('pilihan_jumlah');
					            	}else{
					            	$pilihan_jumlah = Session::get('pilihan_jumlah');
					            	}

					            	if(Input::Old('jumlah_idcard')<>""){
					            	$jumlah_idcard = Input::Old('jumlah_idcard');
					            	}else{
					            	$jumlah_idcard = Session::get('jumlah_idcard');
					            	}
					         ?>
				            <input type="radio" required name="pilihan_jumlah" value="0" id="hide" <?php if($pilihan_jumlah=='0'){echo "checked";} ?> /> 10 Kartu / Pcs (Minimal Order)   {{$errors->first('pilihan_jumlah')}}<br><br>
				            <table><td><input type="radio" required name="pilihan_jumlah" value="1" id="show" <?php if($pilihan_jumlah=='1'){echo "checked";} ?> />  Custom Jumlah </td>
				            	<td>
				            		<b id="p"  ><input type="number" min="10"  name="jumlah_idcard" style="width:100px;height:30px" value="{{$jumlah_idcard}}" /><strong> Kartu / Pcs </strong>
				            		</b>
				            	</td>
				            <td>{{$errors->first('jumlah_idcard')}}</td></table>
				            <br><br>
				            </div>
				      		</div>
				      		

				    </div>
			<hr id="hr1" />
			<font color="red">* Data tidak boleh kosong</font><br><br>

			<p style="margin-bottom:55px"><button type="submit" id="i_submit" class="btn btn-success pull-right" style="width:125px">Lanjutkan</button>{{form::close()}}<a href="{{URL::to('/')}}"><button class="btn btn-danger pull-right" style="width:125px; margin-right:5px">Kembali</button></a></p>
			
			

			</div>
	</div>
	</div>

	<div class="modal fade" id="gantiorder" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog" style="width:80%">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:10px">Ganti order</label></h4>
                    </div>
                    <div class="container" style="width:100%">
                    	<br>
					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Brosur</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_marketting-kit.jpg')}}" /><br><br>
					           <a href="{{URL::to('order/orderbrosur')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>  
					          </div> 
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">ID Card</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_kartu.jpg')}}" /></br></br>
					          <a href="{{URL::to('order/orderidcard')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>     
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Packaging</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_packaging.jpg')}}" /></br></br>
					           <a href="{{URL::to('order/orderpackaging')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Kaos</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/tshirt_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordertshirt')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Nota</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/nota_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordernota')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>
					</div> 
				</div> 
                 </div>
</div>
	<script type="text/javascript">

		$('#i_submit').click( function() {
		    //check whether browser fully supports all File API
		    if (window.File && window.FileReader && window.FileList && window.Blob)
		    {
		        //get the file size and file type from file input field
		        var fsize = $('#i_file')[0].files[0].size;
		        var ftype = $('#i_file')[0].files[0].type;
		       
		        if(fsize>5097152) //do something if file size more than 1 mb (1048576)
		        {
		            setTimeout(function(){
				       alert("File desain terlalu besar\nSilahkan ganti!");
				    }, 1000);
		           	return false; 
		        }

		      //   else{
		      //  		 switch(ftype)
				    //     {
				    //         case 'image/png':
				    //         case 'image/gif':
				    //         case 'image/jpg':
				    //         case 'image/jpeg':
				    //         case 'image/pjpeg':
				    //         case 'image/cdr':
				    //         case 'image/psd':
				    //         case 'files/rar':
				    //         	break;
				    //         default:
				    //             alert('File tidak sesuai\nSilahkan ganti!');
			     //       			return false; 

				    //     }
			     // }

		    }else{
		        alert("Please upgrade your browser, because your current browser lacks some new features we need!");
		    }
		});


	</script>
@stop
@stop